#include <iostream>
#include <iterator>
#include <string>
#include <cctype>
#include <vector>

using std::vector;
using namespace std;
int main()
{
    string s1 = "hello world";
    cout << s1 << endl;

    auto a = s1.begin();
    auto b = s1.end();
    *a = toupper(*a);
    cout << s1 << endl;

    for(auto it = s1.begin(); it != s1.end() && !isspace((*it)); it++)
    {
        (*it) = toupper(*it);
    }

    cout << s1 << endl;

    vector<int>::iterator it;
    string::iterator it2;

    vector<string>::const_iterator it3;
    string::const_iterator it4;

    vector<int> v1;
    const vector<int> cv;
    vector<string> svec;

    auto a1 = v1.begin(); //vector<int>::iterator
    auto a2 = cv.begin(); //vector<int>::const_iterator
    auto a3 = cv.cbegin(); //等同于a2

    svec.push_back("hello");
    auto is = svec.begin();
    cout << is->empty() << endl;


    vector<int> nums = {0,1,2,3,4,5,6,7,8,9};
    auto bgn = nums.begin();
    auto end = nums.end();
    auto mib = nums.begin() + nums.size()/2;
    int mach;
    cin >> mach;
    int cnt = 0;

    while(*mib != mach && bgn != end)
    {
        cnt ++;
        cout << "begin:" << *bgn;
        cout << "end:" << *end;
        cout << "mib:" << *mib << endl;
        if((*mib) > mach)
        {
            end = mib;
        }else{
            bgn = mib + 1;
        }
        mib = bgn + (end - bgn)/2;
        //cout << "mib:" << *mib << endl;
    }

    cout << "cnt:" << cnt << "make:" << *mib << endl;




    return 0;
}
